package com.jimster.plugins.iterator
{
	public class ArrayIterator
	{
		//Variables
		private var arrCollection:Array;
		private var numIndex:Number;
		
		//Constructor
		public function ArrayIterator( $data:Array )
		{
			this.arrCollection = new Array();
			this.arrCollection = $data;
			this.numIndex = 0;
		}
		
		//Public methods
		public function hasNext():Boolean
		{
			return this.numIndex < this.arrCollection.length - 1 ;
		}
		
		public function hasPrevious():Boolean
		{
			return this.numIndex > 0;
		}
		
		public function next():Object
		{
			this.numIndex += 1;
			return this.arrCollection[ this.numIndex ];
		}
		
		public function previous():Object
		{
			this.numIndex -= 1;
			return this.arrCollection[ this.numIndex ];
		}
		
		public function updateIndex( $index:Number )
		{
			this.numIndex = $index;
		}
		
		public function resetNext():void
		{
			this.numIndex = -1;
		}
		
		public function resetPrevious():void
		{
			this.numIndex = this.arrCollection.length;
		}
		
	}
}